Imports System.Collections.Generic

Public Class ServiceProvider
#Region "Constructors and Destructors"

    ''' <summary>
    ''' Initializes a new instance of the ServiceProvider class.
    ''' </summary>
    Public Sub New(name__1 As String, url__2 As String)
        Url = url__2
        Name = name__1
    End Sub

    Public Sub New()
    End Sub

#End Region

#Region "Public Properties"

    Public Property Name() As String

    Public Property Url() As String

#End Region

#Region "Public Methods"

    Public Shared Function GetDefaultServiceProviders() As IEnumerable(Of ServiceProvider)
        'VB doesn't have Yield keyword in Framework 4.0
        Dim lst As New List(Of ServiceProvider)

        For Each item As String In My.Settings.List
            Dim serviceDescArr As String() = item.Split(",")

            Dim serviceName As String = serviceDescArr(0)
            Dim serviceUrl As String = serviceDescArr(1)
            lst.Add(New ServiceProvider(serviceName, serviceUrl))
        Next

        lst.Add(New ServiceProvider(My.Resources.BingHybrid, Nothing))
        lst.Add(New ServiceProvider(My.Resources.GoogleSatellite, Nothing))
        lst.Add(New ServiceProvider(My.Resources.GoogleMap, Nothing))
        'these don't seem to work...
        'lst.Add(New ServiceProvider(My.Resources.YahooSatellite, Nothing))
        'lst.Add(New ServiceProvider(My.Resources.YahooMap, Nothing))
        'I don't want to support!
        'lst.Add(New ServiceProvider(My.Resources.WMSMap, Nothing))
        Return lst
    End Function

    Public Overrides Function ToString() As String
        Return Name
    End Function

#End Region
End Class
